﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace GameLibrary.Input
{
    public class CMouse
    {
        #region Fields
        public static CMouseButton LeftButton = new CMouseButton(MouseButtons.LeftButton);
        public static CMouseButton MiddleButton = new CMouseButton(MouseButtons.MiddleButton);
        public static CMouseButton RightButton = new CMouseButton(MouseButtons.RightButton);
        public static CMouseButton ExtraButton1 = new CMouseButton(MouseButtons.ExtraButton1);
        public static CMouseButton ExtraButton2 = new CMouseButton(MouseButtons.ExtraButton2);

        public static Vector2 Position = new Vector2(0, 0);
        public static Vector2 OldPosition = new Vector2(0, 0);
        public static Vector2 PositionDelta = new Vector2(0, 0);
        public static float X;
        public static float Y;

        public static float ScrollWheelValue = 0;
        public static float OldScrollWheelValue = 0;
        public static float ScrollWheelDelta = 0;
        #endregion

        #region Update
        public static void Update()
        {
            LeftButton.Update();
            MiddleButton.Update();
            RightButton.Update();
            ExtraButton1.Update();
            ExtraButton2.Update();

            MouseState mouseState = Mouse.GetState();

            OldPosition = Position;
            Position = new Vector2(mouseState.X, mouseState.Y);
            PositionDelta = Position - OldPosition;
            X = Position.X;
            Y = Position.Y;

            OldScrollWheelValue = ScrollWheelValue;
            ScrollWheelValue = mouseState.ScrollWheelValue;
            ScrollWheelDelta = ScrollWheelValue - OldScrollWheelValue;

        }
        #endregion
    }
}
